package com.myccb.app.view.index;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.myccb.app.R;
import com.myccb.app.base.BaseActivity;
import com.myccb.app.widget.CommonToolBar;
import com.myccb.app.widget.rollpageview.ColorPointHintView;
import com.myccb.app.widget.rollpageview.LoopPagerAdapter;
import com.myccb.app.widget.rollpageview.RollPagerView;

public class LongPayActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.longpay_layout);


        CommonToolBar commonToolBar=findViewById(R.id.common_toolbar);
        setSupportActionBar(commonToolBar.getToolbar());
        commonToolBar.setOnLeftButtonClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        RollPagerView lifeAdv=findViewById(R.id.longpay_ads);
        lifeAdv.setHintView(new ColorPointHintView(this,getResources().getColor(R.color.colorPrimary),getResources().getColor(R.color.Grey200)));
        lifeAdv.setAdapter(new LoopPagerAdapter(lifeAdv) {
            private int[] adImgs={
                    R.mipmap.index_main_home_adv_1, R.mipmap.index_main_home_adv_2,
                    R.mipmap.index_main_home_adv_3, R.mipmap.index_main_home_adv_4
            };
            @Override
            public View getView(ViewGroup container, int position) {
                ImageView view = new ImageView(container.getContext());
                view.setImageResource(adImgs[position]);
                view.setScaleType(ImageView.ScaleType.CENTER_CROP);
                view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
                return view;
            }
            @Override
            public int getRealCount() {
                return adImgs.length;
            }
        });
    }
}